aboutsummaryrefslogtreecommitdiffstats
path: root/src/routes/(app)/[username]/(profile)/+layout.server.ts
diff options
context:
space:
mode:
authorAdam Soltys <[email protected]>2024-10-10 10:16:03 -0700
committerAdam Soltys <[email protected]>2024-10-10 12:18:06 -0700
commit34d68f2c8f97f35514ada10aee3207c134846c78 (patch)
treec46f52f2a2fed84dbb4253a4c98ba22e4e94fa9c /src/routes/(app)/[username]/(profile)/+layout.server.ts
parentaa5ab97f1b314bd4e7a2358e49572eb1a02baf7b (diff)
downloadcoinos-ui-34d68f2c8f97f35514ada10aee3207c134846c78.tar.gz
coinos-ui-34d68f2c8f97f35514ada10aee3207c134846c78.zip
await data
Diffstat (limited to 'src/routes/(app)/[username]/(profile)/+layout.server.ts')
-rw-r--r--src/routes/(app)/[username]/(profile)/+layout.server.ts25
1 files changed, 5 insertions, 20 deletions
diff --git a/src/routes/(app)/[username]/(profile)/+layout.server.ts b/src/routes/(app)/[username]/(profile)/+layout.server.ts
index 14580694..bf499fb1 100644
--- a/src/routes/(app)/[username]/(profile)/+layout.server.ts
+++ b/src/routes/(app)/[username]/(profile)/+layout.server.ts
@@ -5,25 +5,10 @@ export async function load({ depends, parent }) {
let { subject, user } = await parent();
- subject.follows = [];
- subject.followers = [];
+ let count = get(`/${subject.pubkey}/count`).catch(() => 0);
+ let follows = get(`/${subject.pubkey}/follows`).catch(() => []);
+ let followers = get(`/${subject.pubkey}/followers`).catch(() => []);
+ let followList = get(`/${user.pubkey}/follows?tagsonly=true`).catch(() => []);
- try {
- subject.follows = await get(`/${subject.pubkey}/follows`);
- } catch (e) {
- console.log("problem fetching follows", e);
- }
-
- try {
- subject.followers = await get(`/${subject.pubkey}/followers`);
- } catch (e) {
- console.log("problem fetching followers", e);
- }
-
- // subject.followers = [];
- if (user) {
- user.follows = await get(`/${user.pubkey}/follows?tagsonly=true`);
- }
-
- return { subject, user };
+ return { count, follows, followers, followList };
}